import request from '../../../utils/request'
import type { data, records } from './type'
enum API {
  GRAND_URL = '/admin/product/baseTrademark/',
  //添加品牌
  ADDGRAND_URL = '/admin/product/baseTrademark/save',
  //修改已有品牌
  UPDATEGRADN_URL = '/admin/product/baseTrademark/update',
  //删除已有的品牌
  DELETEGRAND_URL = '/admin/product/baseTrademark/remove/'
}

export const reqGrand = (page: number, limit: number) => request.get<any, data>(API.GRAND_URL + `${page}/${limit}`)
export const reqUpdateGrand = (data: records) => {
  if (data.id) {
    return request.put<any, any>(API.UPDATEGRADN_URL, data)
  } else {
    return request.post<any, any>(API.ADDGRAND_URL, data)
  }
}
export const reqDeleteGrand = (id:number) => request.delete<any,any>(API.DELETEGRAND_URL + id)